package com.pactera.madp.cp.common.config;

import com.pactera.madp.cp.config.ConstantConfig;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.io.Serializable;

/**
 * @author: chenhao
 * @date: 2021/7/16 16:10
 * @description:
 */
@ConfigurationProperties("wechat-component")
@Component
@Data
public class WechatComponentConfig implements Serializable {
    private static final long serialVersionUID = -3560270490490752017L;
    /**
     * 三方平台令牌（component_access_token）
     */
    public static final String CACHE_COMPONENT_ACCESS_TOKEN = "COMPONENT_ACCESS_TOKEN";
    /**
     * 验证票据（component_verify_ticket)
     */
    public static final String CACHE_COMPONENT_VERIFY_TICKET = "COMPONENT_VERIFY_TICKET";
    /**
     * 预授权码（pre_auth_code）
     */
    public static final String CACHE_PRE_AUTH_CODE = "PRE_AUTH_CODE";
    /**
     * 授权令牌（authorizer_access_token）
     */
    public static final String CACHE_AUTHORIZER_TOKEN = "AUTHORIZER_TOKEN";
    /**
     * 授权刷新令牌（authorizer_refresh_token）
     */
    public static final String CACHE_AUTHORIZER_REFRESH_TOKEN = "AUTHORIZER_REFRESH_TOKEN";

    public static final String appId="wxb79a5493081e3d80";
    public static final String appSecret="2d8fc31279029b0c7cac4d9592824501";
    public static final String messageToken="PhdYjF63Q72D38T7MaDp";
    public static final String encodingAESKey="2xDNCRH4RZLG8DHyc8ENWd7LtjzrzV4MsgKer6EMaDp";
    public static final String redirectUri= ConstantConfig.getApiUrl()+"/cp/message/$APPID$";

    /**
     * 微信域名
     */
    private static String url="https://api.weixin.qq.com";
    /**
     * 获取令牌 component_access_token
     */
    public static final String componentAccessTokenUrl= url +"/cgi-bin/component/api_component_token";
    /**
     *
     */
    public static final String getPreAuthCodeUrl=url +"/cgi-bin/component/api_create_preauthcode";
    public static final String apiQueryAuthUrl=url +"/cgi-bin/component/api_query_auth";
    public static final String apiAuthorizerTokenUrl=url +"/cgi-bin/component/api_authorizer_token";
    public static final String apiGetAuthorizerInfoUrl =url +"/cgi-bin/component/api_get_authorizer_info";
    public static final String apiGetAuthorizerOptionUrl =url +"/cgi-bin/component/api_get_authorizer_option";
    public static final String clearQuotaUrl =url +"/cgi-bin/component/clear_quota";

    public static final String componentLoginPagePCUrl ="https://mp.weixin.qq.com/cgi-bin/componentloginpage";

    public static final String componentLoginPageMBUrl ="https://mp.weixin.qq.com/safe/bindcomponent";

}
